//
//  BaseTableViewController.swift
//  DSWeiBo
//
//  Created by iOS聚商 on 2017/6/28.
//  Copyright © 2017年 dreamSun. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController,VisitorViewDelgate {

    
    //定义一个变量保存用户是否登录
    var userLogin = true
    //定义属性保存未登录界面
    var visitorView = VisitorView()
    
    
    override func loadView() {
        
        userLogin ? super.loadView() : setupVisitorView()
        
    }
   
    
    /// 创建未登录界面
    private func setupVisitorView() {
        //初始化未登录界面
        let customView = VisitorView()
        customView.delegate = self
        view = customView
        visitorView = customView

        
        //设置导航条未登录按钮
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: .plain, target: self, action: #selector(BaseTableViewController.registBtnClick))
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: .plain, target: self, action: #selector(BaseTableViewController.loginBtnClick))

        
    }
    
    //VisitorViewDelgate
    func loginBtnClick() {
        print("登录")
    }
    
    func registBtnClick() {
        print("注册")
    }
    
    
}
